import { FormSchema } from "/@/components/Form";

export const formSchema: FormSchema[] = [
  {
    field: "score",
    label: "评分",
    component: "InputNumber",
    rules: [
      {
        type: "number",
        required: true,
        validator: async (_rule, value) => {
          if (!value) {
            return Promise.reject("评分不能为空");
          }
          if (value < 0 || value > 100 || value % 1 != 0) {
            return Promise.reject("请输入 0-100 之间的一个整数");
          }
          return Promise.resolve();
        },
        trigger: "change",
      },
    ],
  },
  {
    field: "remark",
    label: "评语",
    component: "InputTextArea",
    required: true,
    componentProps: {
      row: 5,
    },
  },
];
